<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>菜品列表</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.7.2/css/all.min.css" rel="stylesheet">
    <style>
        body {
            font-family: 'Inter', sans-serif;
            overflow: hidden;
            position: relative;
        }

        /* 背景粒子样式 */
        .bg-particles {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            z-index: -1;
            background: linear-gradient(135deg, #e6f7ff 0%, #f2f2f2 100%);
        }

        .bg-particles span {
            position: absolute;
            border-radius: 100%;
            pointer-events: none;
            animation: animate 5s linear infinite;
        }

        @keyframes animate {
            0% {
                transform: translateY(0);
                opacity: 0;
            }
            10% {
                opacity: 1;
            }
            90% {
                opacity: 1;
            }
            100% {
                transform: translateY(-1000%);
                opacity: 0;
            }
        }
    </style>
</head>
<body class="bg-gray-100">
<!-- 背景粒子 -->
<div class="bg-particles">
    <span style="left: 10%; width: 10px; height: 10px; background: rgba(0, 123, 255, 0.2); animation-delay: 0s;"></span>
    <span style="left: 20%; width: 15px; height: 15px; background: rgba(40, 167, 69, 0.2); animation-delay: 1s;"></span>
    <span style="left: 30%; width: 8px; height: 8px; background: rgba(220, 53, 69, 0.2); animation-delay: 2s;"></span>
    <span style="left: 40%; width: 12px; height: 12px; background: rgba(23, 162, 184, 0.2); animation-delay: 3s;"></span>
    <span style="left: 50%; width: 18px; height: 18px; background: rgba(255, 165, 0, 0.2); animation-delay: 4s;"></span>
    <span style="left: 60%; width: 9px; height: 9px; background: rgba(0, 123, 255, 0.2); animation-delay: 5s;"></span>
    <span style="left: 70%; width: 13px; height: 13px; background: rgba(40, 167, 69, 0.2); animation-delay: 6s;"></span>
    <span style="left: 80%; width: 11px; height: 11px; background: rgba(220, 53, 69, 0.2); animation-delay: 7s;"></span>
    <span style="left: 90%; width: 16px; height: 16px; background: rgba(23, 162, 184, 0.2); animation-delay: 8s;"></span>
</div>
<h2 class="text-2xl font-bold text-center text-gray-800 mt-8">菜品列表</h2>
<h3 class="text-lg text-center text-gray-600 my-4" th:text="${list}"></h3>
<div class="overflow-x-auto mx-4">
    <table class="min-w-full bg-white shadow-md rounded-lg overflow-hidden">
        <thead class="bg-blue-500 text-white">
        <tr>
            <th class="px-6 py-3 text-left text-xs font-medium uppercase tracking-wider">菜品分类名</th>
            <th class="px-6 py-3 text-left text-xs font-medium uppercase tracking-wider">菜品名</th>
            <th class="px-6 py-3 text-left text-xs font-medium uppercase tracking-wider">价格</th>
            <th class="px-6 py-3 text-left text-xs font-medium uppercase tracking-wider">状态</th>
            <th class="px-6 py-3 text-left text-xs font-medium uppercase tracking-wider">创建时间</th>
            <th class="px-6 py-3 text-left text-xs font-medium uppercase tracking-wider">更新时间</th>
            <th class="px-6 py-3 text-left text-xs font-medium uppercase tracking-wider">操作</th>
        </tr>
        </thead>
        <tbody class="divide-y divide-gray-200">
        <tr th:each="dish:${page.list}">
            <td class="px-6 py-4 whitespace-nowrap" th:text="${dish.categoryName}"></td>
            <td class="px-6 py-4 whitespace-nowrap" th:text="${dish.name}"></td>
            <td class="px-6 py-4 whitespace-nowrap" th:text="${dish.price}"></td>
            <td class="px-6 py-4 whitespace-nowrap" th:text="${dish.status}==0?'起售':'停售'"></td>
            <td class="px-6 py-4 whitespace-nowrap" th:text="${dish.formattedCreateTime}"></td>
            <td class="px-6 py-4 whitespace-nowrap" th:text="${dish.formattedUpdateTime}"></td>
            <td class="px-6 py-4 whitespace-nowrap">
                <a th:href="@{/updateStatus/}+${dish.id}" class="inline-block px-4 py-2 bg-orange-500 text-white rounded-md hover:bg-orange-600 focus:outline-none focus:ring focus:ring-blue-300" th:text="${dish.status}==0?'停售':'起售'"></a>
                <a th:href="@{/updateById/}+${dish.id}" class="inline-block px-4 py-2 bg-teal-500 text-white rounded-md hover:bg-teal-600 focus:outline-none focus:ring focus:ring-teal-300" th:text="修改"></a>
                <a th:href="@{/deleteById/}+${dish.id}" class="inline-block px-4 py-2 bg-red-500 text-white rounded-md hover:bg-red-600 focus:outline-none focus:ring focus:ring-red-300" th:text="删除"></a>
            </td>
        </tr>
        </tbody>
    </table>
</div>
<div class="flex justify-center mt-8">
    <ul class="flex space-x-2">
        <li>
            <a th:href="@{/getList/1}" class="inline-block px-3 py-2 border border-gray-300 rounded-md text-gray-700 hover:bg-gray-100 focus:outline-none focus:ring focus:ring-gray-200">首页</a>
        </li>
        <li th:if="${page.current}>1">
            <a th:href="@{/getList/}+(${page.current}-1)" class="inline-block px-3 py-2 border border-gray-300 rounded-md text-gray-700 hover:bg-gray-100 focus:outline-none focus:ring focus:ring-gray-200">上一页</a>
        </li>
        <li>
            <span class="inline-block px-3 py-2 border border-gray-300 rounded-md bg-gray-200 text-gray-700" th:text="(${page.current})"></span>
        </li>
        <li th:if="(${page.current}*3)<${page.total}">
            <a th:href="@{/getList/}+(${page.current}+1)" class="inline-block px-3 py-2 border border-gray-300 rounded-md text-gray-700 hover:bg-gray-100 focus:outline-none focus:ring focus:ring-gray-200">下一页</a>
        </li>
        <li>
            <a th:href="@{/getList/}+${page.end}" class="inline-block px-3 py-2 border border-gray-300 rounded-md text-gray-700 hover:bg-gray-100 focus:outline-none focus:ring focus:ring-gray-200">末页</a>
        </li>
    </ul>
    <a th:href="@{/add}" class="ml-4 inline-block px-4 py-2 bg-green-500 text-white rounded-md hover:bg-green-600 focus:outline-none focus:ring focus:ring-green-300" th:text="新增"></a>
</div>
</body>
</html>
